#pragma once

#include <string>

#include <WINDOWS.H>
#include <usbioctl.h>

class USBDevice
{
public:
	static std::wstring	GetDescriptionByKeyName(const std::wstring &deviceKeyName);
	static std::wstring GetInstanceIDByKeyName(const std::wstring &driverKeyName);

	USBDevice(void);
	~USBDevice(void);

	int								GetPortNumber()			{ return m_devicePortNumber; }
	std::wstring					GetHubDevicePath()		{ return m_deviceHubDevicePath; }
	std::wstring					GetDriverKey()			{ return m_deviceDriverKey; }
	std::wstring					GetInstanceID()			{ return m_deviceInstanceID; }
	std::wstring					GetName()				{ return m_deviceName; }
	std::wstring					GetManufacturer()		{ return m_deviceManufacturer; }
	std::wstring					GetProduct()			{ return m_deviceProduct; }
	std::wstring					GetSerialNumber()		{ return m_deviceSerialNumber; }
	const USB_DEVICE_DESCRIPTOR*	GetDeviceDescriptor()	{ return &m_deviceDescriptor; }

	void	SetPortNumber(const int portNumber)								{ m_devicePortNumber = portNumber; }
	void	SetHubDevicePath(const wchar_t *pHubDevicePath)					{ m_deviceHubDevicePath = pHubDevicePath; }
	void	SetDriverKey(const wchar_t *pDriverKey)							{ m_deviceDriverKey = pDriverKey; }
	void	SetInstanceID(const wchar_t *pInstanceID)						{ m_deviceInstanceID = pInstanceID; }
	void	SetName(const wchar_t *pName)									{ m_deviceName = pName; }
	void	SetManufacturer(const wchar_t *pManufacturer)					{ m_deviceManufacturer = pManufacturer; }
	void	SetProduct(const wchar_t *pProduct)								{ m_deviceProduct = pProduct; }
	void	SetSerialNumber(const wchar_t *pSerialNumber)					{ m_deviceSerialNumber = pSerialNumber; }
	void	SetDeviceDescriptor(const USB_DEVICE_DESCRIPTOR &descriptor)	{ memcpy(&m_deviceDescriptor, &descriptor, sizeof(USB_DEVICE_DESCRIPTOR)); }

private:
	int						m_devicePortNumber;
	std::wstring			m_deviceDriverKey;
	std::wstring			m_deviceHubDevicePath;
	std::wstring			m_deviceInstanceID;
	std::wstring			m_deviceName;
	std::wstring			m_deviceManufacturer;
	std::wstring			m_deviceProduct;
	std::wstring			m_deviceSerialNumber;
	USB_DEVICE_DESCRIPTOR	m_deviceDescriptor;
};
